<!-- Begin: cppage - Register -->
<div class="cppage register">
    <div class="header">
        <h2>Atualizar meus dados</h2>
    </div>
    <form id="register">

        <? if (CPanel::$account->a_type == 'F'): ?>
            <div class="name">
                <label>Nome:</label>
                <input class="input" name="name" type="text" value="<?= CPanel::$account->c_name ?>">
            </div>
        <? else: ?>
            <?
            $data = DbGet::enterprises_transactions_paydate(CPanel::$account->e_id);
            $expiration = strtotime($data[0]->_expiration);
            if (($expiration < time()) and $asd = 0) {
                ?>
                <div class="plan">
                    <label>Plano* :</label>
                    <select class="input required" name="plan" title="Plano">
                        <option></option>
                        <? foreach (DbGet::plans('J') as $plan): ?>
                            <option value="<?= $plan->id ?>" <? if (CPanel::$account->p_id == $plan->id) { ?> selected="selected" <? } ?>  ><?= $plan->name ?></option>
        <? endforeach ?>
                    </select>
                </div>
    <? } ?>
            <div class="fancyname">
                <label>Nome Fantasia:</label>
                <input class="input" type="text" name="fancyname" value="<?= CPanel::$account->fancyname ?>">
            </div>
            <div class="corporatename">
                <label>Razão Social:</label>
                <input class="input" type="text" name="corporatename" value="<?= CPanel::$account->corporatename ?>">
            </div>
            <div class="website">
                <label>Website:</label>
                <input class="input" type="text" name="website" value="<?= CPanel::$account->website ?>">
            </div>
<? endif ?>
        <div class="email">
            <label>E-mail:</label>
            <input class="input disabled" type="text" disabled value="<?= CPanel::$account->email ?>">
        </div>
<? if (CPanel::$account->a_type == 'F'): ?>
            <div class="cpfcnpj">
                <label>CPF:</label>
                <input class="input disabled" type="text" disabled name="cpfcnpj" value="<?= str_pad(CPanel::$account->cpf, 11, 0, 0) ?>">
                <input type="hidden" name="cpf" value="<?= CPanel::$account->cpf ?>">
            </div>
<? else: ?>
            <div class="cpfcnpj">
                <label>CNPJ:</label>
                <input class="input disabled" type="text" disabled name="cpfcnpj" value="<?= str_pad(CPanel::$account->cnpj, 14, 0, 0) ?>">
                <input type="hidden" name="cnpj" value="<?= CPanel::$account->cnpj ?>">
            </div>
<? endif ?>
        <div class="state">
            <label>Estado* :</label>
            <select class="input required" name="state" title="Estado">
                <option></option>
                <?
                foreach (DbGet::states() as $state):
                    if ($state->id == CPanel::$account->id_state):
                        ?>
                        <option value="<?= $state->id ?>" selected><?= $state->symbol ?></option>
                    <? else: ?>
                        <option value="<?= $state->id ?>"><?= $state->symbol ?></option>
                    <?
                    endif;
                endforeach
                ?>
            </select>
        </div>
        <div class="city">
            <label>Cidade* :</label>
            <select class="input required" name="city" title="Cidade">
                <option></option>
                <?
                foreach (DbGet::cities(CPanel::$account->id_state) as $city):
                    if ($city->id == CPanel::$account->id_city):
                        ?>
                        <option value="<?= $city->id ?>" selected><?= $city->name ?></option>
                    <? else: ?>
                        <option value="<?= $city->id ?>"><?= $city->name ?></option>
                    <?
                    endif;
                endforeach
                ?>
            </select>
        </div>
        <div class="address">
            <label>Endereço* :</label>
            <input class="input required" type="text" name="address" maxlength="50" title="Endereço" value="<?= CPanel::$account->address ?>">
        </div>
        <div class="number">
            <label>Número* :</label>
            <input class="input required" type="text" name="number" title="Número" value="<?= CPanel::$account->number ?>">
        </div>
        <div class="district">
            <label>Bairro* :</label>
            <input class="input required" type="text" name="district" maxlength="50" title="Bairro" value="<?= CPanel::$account->district ?>">
        </div>
        <div class="complement">
            <label>Complemento:</label>
            <input class="input" type="text" name="complement" maxlength="30" title="Complemento" value="<?= CPanel::$account->complement ?>">
        </div>
        <div class="cep">
            <label>CEP* :</label>
            <input class="input required" type="text" name="cep" title="CEP" value="<?= CPanel::$account->cep ?>">
        </div>
        <fieldset>
            <legend>Telefone</legend>
            <ul class="phones">
                <li>
                    <div class="phone-type">
                        <label>Tipo:</label>
                        <select class="input" name="phone-type[]" title="Tipo do Telefone">
                            <? foreach (DbGet::phones_types() as $type): ?>
                                <option value="<?= $type->id ?>"><?= $type->name ?></option>
<? endforeach; ?>
                        </select>
                    </div>
                    <div class="phone-areacode">
                        <label>DDD:</label>
                        <input class="input" type="text" name="phone-areacode[]" title="DDD do Telefone">
                    </div>
                    <div class="phone-number">
                        <label>Número:</label>
                        <input class="input" type="text" name="phone-number[]" title="Número do Telefone">
                    </div>
                    <input type="hidden" name="phone-id[]" value="0">
                    <a class="add" href="javascript:;">Adicionar</a>
                    <a class="del" href="javascript:;">Remover</a>
                </li>
<? foreach (DbGet::phones(CPanel::$account->a_id, CPanel::$account->a_type) as $phone): ?>
                    <li>
                        <div class="phone-type">
                            <label>Tipo:</label>
                            <select class="input" name="phone-type[]" title="Tipo do Telefone">
                                <?
                                foreach (DbGet::phones_types() as $type):
                                    if ($type->id == $phone->id_type):
                                        ?>
                                        <option value="<?= $type->id ?>" selected><?= $type->name ?></option>
                                    <? else: ?>
                                        <option value="<?= $type->id ?>"><?= $type->name ?></option>
                                    <?
                                    endif;
                                endforeach;
                                ?>
                            </select>
                        </div>
                        <div class="phone-areacode">
                            <label>DDD:</label>
                            <input class="input required" type="text" name="phone-areacode[]" title="DDD do Telefone" value="<?= $phone->areacode ?>">
                        </div>
                        <div class="phone-number">
                            <label>Número:</label>
                            <input class="input required" type="text" name="phone-number[]" title="Número do Telefone" value="<?= $phone->number ?>">
                        </div>
                        <input type="hidden" name="phone-id[]" value="<?= $phone->id ?>">
                        <a class="add" href="javascript:;">Adicionar</a>
                        <a class="del" href="javascript:;">Remover</a>
                    </li>
<? endforeach ?>
                <input type="hidden" name="phones-excluded">
            </ul>
        </fieldset>
        <div class="contacts">
            <label>Contatos:</label>
            <textarea class="input" name="contacts" title="Contatos"><?= CPanel::$account->contacts ?></textarea>
        </div>
        <input type="hidden" name="id" value="<?= CPanel::$account->a_id ?>">
        <input type="hidden" name="cpanel" value="register">
        <input class="submit" type="submit" value="Salvar">
    </form>
</div> <!-- End -->
